package com.ruoyi.contact.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.contact.mapper.ContactLevelMapper;
import com.ruoyi.contact.domain.ContactLevel;
import com.ruoyi.contact.service.IContactLevelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 联系人等级Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-30
 */
@Service
public class ContactLevelServiceImpl implements IContactLevelService 
{
    @Autowired
    private ContactLevelMapper contactLevelMapper;

    /**
     * 查询联系人等级
     * 
     * @param levelId 联系人等级主键
     * @return 联系人等级
     */
    @Override
    public ContactLevel selectContactLevelByLevelId(Long levelId)
    {
        return contactLevelMapper.selectContactLevelByLevelId(levelId);
    }

    /**
     * 查询联系人等级列表
     * 
     * @param contactLevel 联系人等级
     * @return 联系人等级
     */
    @Override
    public List<ContactLevel> selectContactLevelList(ContactLevel contactLevel)
    {
        return contactLevelMapper.selectContactLevelList(contactLevel);
    }

    /**
     * 新增联系人等级
     * 
     * @param contactLevel 联系人等级
     * @return 结果
     */
    @Override
    public int insertContactLevel(ContactLevel contactLevel)
    {
        contactLevel.setCreateTime(DateUtils.getNowDate());
        return contactLevelMapper.insertContactLevel(contactLevel);
    }

    /**
     * 修改联系人等级
     * 
     * @param contactLevel 联系人等级
     * @return 结果
     */
    @Override
    public int updateContactLevel(ContactLevel contactLevel)
    {
        contactLevel.setUpdateTime(DateUtils.getNowDate());
        return contactLevelMapper.updateContactLevel(contactLevel);
    }

    /**
     * 批量删除联系人等级
     * 
     * @param levelIds 需要删除的联系人等级主键
     * @return 结果
     */
    @Override
    public int deleteContactLevelByLevelIds(String levelIds)
    {
        return contactLevelMapper.deleteContactLevelByLevelIds(Convert.toStrArray(levelIds));
    }

    /**
     * 删除联系人等级信息
     * 
     * @param levelId 联系人等级主键
     * @return 结果
     */
    @Override
    public int deleteContactLevelByLevelId(Long levelId)
    {
        return contactLevelMapper.deleteContactLevelByLevelId(levelId);
    }
}
